home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / include / meshP.h < prev    next >
C/C++ Source or Header  |  1992-11-20  |  1KB  |  52 lines

  1. /* Copyright (c) 1992 The Geometry Center; University of Minnesota
  2.    1300 South Second Street;  Minneapolis, MN  55454, USA;
  3.    
  4. This file is part of geomview/OOGL. geomview/OOGL is free software;
  5. you can redistribute it and/or modify it only under the terms given in
  6. the file COPYING, which you should have received along with this file.
  7. This and other related software may be obtained via anonymous ftp from
  8. geom.umn.edu; email: software@geom.umn.edu. */
  9.  
  10. /* Authors: Charlie Gunn, Stuart Levy, Tamara Munzner, Mark Phillips */
  11.  
  12. #ifndef MESHPDEF
  13. #define MESHPDEF
  14.  
  15. #include "geomclass.h"
  16. #include "mesh.h"
  17.  
  18. struct Mesh {
  19.     GEOMFIELDS
  20.     int    flag;
  21.     int     seq;
  22.     int    nu, nv;
  23.     int    umin, umax, vmin, vmax;
  24.     HPoint3    *p;
  25.     Point3     *n, *u;
  26.     ColorA    *c;
  27.     float    *d;
  28.     Point3    *nd;
  29. };
  30.  
  31. #define nuverts(m) (m)->nu
  32. #define nvverts(m) (m)->nv
  33. #define nuquads(m) (((m)->flag & MESH_UWRAP) ? (m)->nu : (m)->nu - 1)
  34. #define nvquads(m) (((m)->flag & MESH_VWRAP) ? (m)->nv : (m)->nv - 1)
  35.  
  36. /*
  37.  * MESHINDEX(u, v, mesh)
  38.  * Returns the index of a point into the mesh->array given its u & v 
  39.  * coordinates.
  40.  */
  41. #define MESHINDEX(u, v, mesh) \
  42.   (((v)%(mesh)->nv)*(mesh)->nu + ((u)%(mesh)->nu))
  43.  
  44. /* 
  45.  * MESHPOINT(u, v, mesh, plist)
  46.  * Returns plist[MESHINDEX(u, v, mesh)]
  47.  */
  48. #define MESHPOINT(u, v, mesh, plist) \
  49.   ((plist)[MESHINDEX(u, v, mesh)])
  50.  
  51. #endif /* ! MESHPDEF */
  52.